/*
 * @Description: 颜色
 * @Author: iamsmiling
 * @Date: 2021-05-23 16:54:08
 * @LastEditTime: 2021-05-26 22:47:52
 */

import 'package:flutter/material.dart';

class ColorKit {
  static Color fromHex(String hexString) {
    if (hexString.isEmpty) return Colors.transparent;
    final buffer = StringBuffer();
    if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
    buffer.write(hexString.replaceFirst('#', ''));
    return Color(int.parse(buffer.toString(), radix: 16));
  }
}
